import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',

    redirect:'/index'
  },
  {
    path:'/home',
    name:'Home',
    component: Home,
    children:[
      {
        path:'/index',
        name:'Index',
        component:()=>import('../views/home/Index.vue')
      }
    ]
  },
  {
    path:'/user',
    name:'User',
    redirect:'/user/index',
    component: Home,
    children: [
      {
        path:'/user/index',
        name:'UserIndex',
        redirect:'/user/profile',
        component:()=>import('../views/user/Index'),
        children:[
          {
            path:"/user/profile",
            name:'Profile',
            component:()=>import('../views/user/Profile')
          },
          {
            path:"/user/editProfile",
            name:'EditProfile',
            component:()=>import('../views/user/editProfile')
          },
          {
            path: '/user/donate',
            name: 'Donate',
            component:()=>import('../views/user/Donate')
          },
          {
            path: '/user/shop',
            name: 'Shop',
            component:()=>import('../views/user/Shop')
          },
          {
            path: '/user/expense',
            name: 'Expense',
            component:()=>import('../views/user/Expense')
          },
          {
            path: '/user/Donatelogs',
            name: 'DonateLogs',
            component:()=>import('../views/user/DonateLogs')
          },
          {
            path: '/user/Message',
            name: 'Message',
            component:()=>import('../views/user/Message')
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import( '../views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import( '../views/Register.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
